<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    class Animal {
      constructor(name) {
        this.name = name;
      }
      run() {
        console.log("跑")
      }
    }
    //  1.extends 父类名称
    class Cat extends Animal {
      constructor(color) {
        // 2.完成继承 需要在构造器中写super()
        super("汤姆")
        this.color = color;
      }
      eat() {
        console.log("吃")
      }
    }






  </script>
</body>

</html>